﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Web;
using System.Data.SqlClient;
using Adex;
using System.Web.UI.WebControls;


namespace MediaMonitor.Common
{

    /// <summary>
    /// Summary description for ReportFuncs
    /// </summary>
    public class ReportFuncs
    {

        #region Report - Meltimedia

        public DataTable GetReportAll_Paged(int userID, DateTime sDate, DateTime eDate, bool searchTV, bool searchRD, bool searchCB, bool searchPR, bool searchOD, string mediaCodes, string sectorName, string subSectorName, string categoryName, string advertiserName, string brandName, string productName, string agencyName, int sPrice, int ePrice, bool fa, int MediaTypeCode, bool searchIN, ObjectDataSourceSelectingEventArgs e, string sortColumn, int maximumRows, int startRowIndex)
        {
            int page = startRowIndex + 1 > maximumRows ? ((startRowIndex / maximumRows) + 1) : 1;

            mediaCodes = mediaCodes != null ? mediaCodes : "";
            sectorName = sectorName != null ? sectorName : "";
            subSectorName = subSectorName != null ? subSectorName : "";
            categoryName = categoryName != null ? categoryName : "";
            advertiserName = advertiserName != null ? advertiserName : "";
            brandName = brandName != null ? brandName : "";
            productName = productName != null ? productName : "";
            agencyName = agencyName != null ? agencyName : "";

            DataTable dt = SPs.GetReportAllPaged(userID, page, maximumRows, sortColumn, sDate, eDate.AddDays(0), searchTV, searchRD, searchCB, searchPR, searchOD, mediaCodes, sectorName, subSectorName, categoryName, advertiserName, brandName, productName, agencyName, sPrice, ePrice, fa, MediaTypeCode, searchIN).GetDataSet().Tables[0];


            int totalRecords = 0;

            if (dt.Rows.Count > 0)
                totalRecords = Utility.ToInt(dt.Rows[0]["TotalRecords"]);

            e.Arguments.TotalRowCount = totalRecords;

            return dt;
        }
        public int GetReportAll_RowCount(int userID, DateTime sDate, DateTime eDate, bool searchTV, bool searchRD, bool searchCB, bool searchPR, bool searchOD, string mediaCodes, string sectorName, string subSectorName, string categoryName, string advertiserName, string brandName, string productName, string agencyName, int sPrice, int ePrice, bool fa, int MediaTypeCode, bool searchIN, ObjectDataSourceSelectingEventArgs e)
        {
            return e.Arguments.TotalRowCount;
        }
        public DataTable GetReportAll_Paged2(int userID, int SDateint, int EDateint, DateTime sDate, DateTime eDate, bool searchTV, bool searchRD, bool searchCB, bool searchPR, bool searchOD, string mediaCodes, string sectorName, string subSectorName, string categoryName, string advertiserName, string brandName, string productName, string agencyName, int sPrice, int ePrice, bool fa, int MediaTypeCode, bool searchIN, ObjectDataSourceSelectingEventArgs e, string sortColumn, int maximumRows, int startRowIndex)
        {
            int page = startRowIndex + 1 > maximumRows ? ((startRowIndex / maximumRows) + 1) : 1;

            mediaCodes = mediaCodes != null ? mediaCodes : "";
            sectorName = sectorName != null ? sectorName : "";
            subSectorName = subSectorName != null ? subSectorName : "";
            categoryName = categoryName != null ? categoryName : "";
            advertiserName = advertiserName != null ? advertiserName : "";
            brandName = brandName != null ? brandName : "";
            productName = productName != null ? productName : "";
            agencyName = agencyName != null ? agencyName : "";

            DataTable dt = SPs.GetReportAllPaged2(userID, page, maximumRows, sortColumn, SDateint,EDateint, sDate, eDate.AddDays(0), searchTV, searchRD, searchCB, searchPR, searchOD, mediaCodes, sectorName, subSectorName, categoryName, advertiserName, brandName, productName, agencyName, sPrice, ePrice, fa, MediaTypeCode, searchIN).GetDataSet().Tables[0];


            int totalRecords = 0;

            if (dt.Rows.Count > 0)
                totalRecords = Utility.ToInt(dt.Rows[0]["TotalRecords"]);

            e.Arguments.TotalRowCount = totalRecords;

            return dt;
        }
        public int GetReportAll_RowCount2(int userID, int SDateint, int EDateint, DateTime sDate, DateTime eDate, bool searchTV, bool searchRD, bool searchCB, bool searchPR, bool searchOD, string mediaCodes, string sectorName, string subSectorName, string categoryName, string advertiserName, string brandName, string productName, string agencyName, int sPrice, int ePrice, bool fa, int MediaTypeCode, bool searchIN, ObjectDataSourceSelectingEventArgs e)
        {
            return e.Arguments.TotalRowCount;
        }
        public DataTable GetReportAll_PagedExport(int userID, DateTime sDate, DateTime eDate, bool searchTV, bool searchRD, bool searchCB, bool searchPR, bool searchOD, string mediaCodes, string sectorName, string subSectorName, string categoryName, string advertiserName, string brandName, string productName, string agencyName, int sPrice, int ePrice, bool fa, int MediaTypeCode, bool searchIN, ObjectDataSourceSelectingEventArgs e, string sortColumn, int maximumRows, int startRowIndex)
        {
            int page = startRowIndex + 1 > maximumRows ? ((startRowIndex / maximumRows) + 1) : 1;

            mediaCodes = mediaCodes != null ? mediaCodes : "";
            sectorName = sectorName != null ? sectorName : "";
            subSectorName = subSectorName != null ? subSectorName : "";
            categoryName = categoryName != null ? categoryName : "";
            advertiserName = advertiserName != null ? advertiserName : "";
            brandName = brandName != null ? brandName : "";
            productName = productName != null ? productName : "";
            agencyName = agencyName != null ? agencyName : "";

            DataTable dt = SPs.GetReportAllPagedExport(userID, page, maximumRows, sortColumn, sDate, eDate.AddDays(0), searchTV, searchRD, searchCB, searchPR, searchOD, mediaCodes, sectorName, subSectorName, categoryName, advertiserName, brandName, productName, agencyName, sPrice, ePrice, fa, MediaTypeCode, searchIN).GetDataSet().Tables[0];


            int totalRecords = 0;

            if (dt.Rows.Count > 0)
                totalRecords = Utility.ToInt(dt.Rows[0]["TotalRecords"]);

            e.Arguments.TotalRowCount = totalRecords;

            return dt;
        }
        public DataTable GetReportAll_PagedExport2(int userID, int SDateint, int EDateint, DateTime sDate, DateTime eDate, bool searchTV, bool searchRD, bool searchCB, bool searchPR, bool searchOD, string mediaCodes, string sectorName, string subSectorName, string categoryName, string advertiserName, string brandName, string productName, string agencyName, int sPrice, int ePrice, bool fa, int MediaTypeCode, bool searchIN, ObjectDataSourceSelectingEventArgs e, string sortColumn, int maximumRows, int startRowIndex)
        {
            int page = startRowIndex + 1 > maximumRows ? ((startRowIndex / maximumRows) + 1) : 1;

            mediaCodes = mediaCodes != null ? mediaCodes : "";
            sectorName = sectorName != null ? sectorName : "";
            subSectorName = subSectorName != null ? subSectorName : "";
            categoryName = categoryName != null ? categoryName : "";
            advertiserName = advertiserName != null ? advertiserName : "";
            brandName = brandName != null ? brandName : "";
            productName = productName != null ? productName : "";
            agencyName = agencyName != null ? agencyName : "";

            DataTable dt = SPs.GetReportAllPagedExport2(userID, page, maximumRows, sortColumn,SDateint,EDateint, sDate, eDate.AddDays(0), searchTV, searchRD, searchCB, searchPR, searchOD, mediaCodes, sectorName, subSectorName, categoryName, advertiserName, brandName, productName, agencyName, sPrice, ePrice, fa, MediaTypeCode, searchIN).GetDataSet().Tables[0];


            int totalRecords = 0;

            if (dt.Rows.Count > 0)
                totalRecords = Utility.ToInt(dt.Rows[0]["TotalRecords"]);

            e.Arguments.TotalRowCount = totalRecords;

            return dt;
        }
        public int GetReportAll_RowCountExport2(int userID, int SDateint, int EDateint, DateTime sDate, DateTime eDate, bool searchTV, bool searchRD, bool searchCB, bool searchPR, bool searchOD, string mediaCodes, string sectorName, string subSectorName, string categoryName, string advertiserName, string brandName, string productName, string agencyName, int sPrice, int ePrice, bool fa, int MediaTypeCode, bool searchIN, ObjectDataSourceSelectingEventArgs e)
        {
            return e.Arguments.TotalRowCount;
        }
        public int GetReportAll_RowCountExport(int userID, DateTime sDate, DateTime eDate, bool searchTV, bool searchRD, bool searchCB, bool searchPR, bool searchOD, string mediaCodes, string sectorName, string subSectorName, string categoryName, string advertiserName, string brandName, string productName, string agencyName, int sPrice, int ePrice, bool fa, int MediaTypeCode, bool searchIN, ObjectDataSourceSelectingEventArgs e)
        {
            return e.Arguments.TotalRowCount;
        }


       
        public DataTable GetReportAll_Count(int userID, DateTime sDate, DateTime eDate, bool searchTV, bool searchRD, bool searchCB, bool searchPR, bool searchOD, string mediaCodes, string sectorName, string subSectorName, string categoryName, string advertiserName, string brandName, string productName, string agencyName, int sPrice, int ePrice, bool fa, bool searchIN, ObjectDataSourceSelectingEventArgs e, string sortColumn, int maximumRows, int startRowIndex)
        {
            int page = startRowIndex + 1 > maximumRows ? ((startRowIndex / maximumRows) + 1) : 1;

            mediaCodes = mediaCodes != null ? mediaCodes : "";
            sectorName = sectorName != null ? sectorName : "";
            subSectorName = subSectorName != null ? subSectorName : "";
            categoryName = categoryName != null ? categoryName : "";
            advertiserName = advertiserName != null ? advertiserName : "";
            brandName = brandName != null ? brandName : "";
            productName = productName != null ? productName : "";
            agencyName = agencyName != null ? agencyName : "";

            DataTable dt = SPs.GetReportAll_Count(userID, page, maximumRows, sortColumn, sDate, eDate.AddDays(0), searchTV, searchRD, searchCB, searchPR, searchOD, mediaCodes, sectorName, subSectorName, categoryName, advertiserName, brandName, productName, agencyName, sPrice, ePrice, fa, searchIN).GetDataSet().Tables[0];


            int totalRecords = 0;

            if (dt.Rows.Count > 0)
                totalRecords = Utility.ToInt(dt.Rows[0]["CountRecord"]);

            e.Arguments.TotalRowCount = totalRecords;

            return dt;
        }
        public DataTable GetReportAll_Count2(int userID, int SDateint, int EDateint, DateTime SDate, DateTime EDate, bool searchTV, bool searchRD, bool searchCB, bool searchPR, bool searchOD, string mediaCodes, string sectorName, string subSectorName, string categoryName, string advertiserName, string brandName, string productName, string agencyName, int sPrice, int ePrice, bool fa, bool searchIN, ObjectDataSourceSelectingEventArgs e, string sortColumn, int maximumRows, int startRowIndex)
        {
            int page = startRowIndex + 1 > maximumRows ? ((startRowIndex / maximumRows) + 1) : 1;

            mediaCodes = mediaCodes != null ? mediaCodes : "";
            sectorName = sectorName != null ? sectorName : "";
            subSectorName = subSectorName != null ? subSectorName : "";
            categoryName = categoryName != null ? categoryName : "";
            advertiserName = advertiserName != null ? advertiserName : "";
            brandName = brandName != null ? brandName : "";
            productName = productName != null ? productName : "";
            agencyName = agencyName != null ? agencyName : "";

            DataTable dt = SPs.GetReportAllCount2(userID, page, maximumRows, sortColumn, SDateint, EDateint, SDate, EDate, searchTV, searchRD, searchCB, searchPR, searchOD, searchIN, mediaCodes, sectorName, subSectorName, categoryName, advertiserName, brandName, productName, agencyName, sPrice, ePrice, fa).GetDataSet().Tables[0];


            int totalRecords = 0;

            if (dt.Rows.Count > 0)
                totalRecords = Utility.ToInt(dt.Rows[0]["CountRecord"]);

            e.Arguments.TotalRowCount = totalRecords;

            return dt;
        }
        public int GetReportAll_RowCountTotal2(int userID, bool searchTV, bool searchRD, bool searchPR, bool searchOD, string mediaCodes, string advertiserName, string brandName, string productName, string agencyName, int sPrice, int ePrice, bool fa, bool searchIN, ObjectDataSourceSelectingEventArgs e)
        {
            return e.Arguments.TotalRowCount;
        }
        public int GetReportAll_RowCountTotal(int userID,  bool searchTV, bool searchRD, bool searchPR, bool searchOD, string mediaCodes,  string advertiserName, string brandName, string productName, string agencyName, int sPrice, int ePrice, bool fa, bool searchIN, ObjectDataSourceSelectingEventArgs e)
        {
            return e.Arguments.TotalRowCount;
        }





        #endregion

        #region TVCR

        public DataTable GetReportTVCR_Paged(int userID, DateTime sDate, DateTime eDate, int mediaTypeCode, string mediaCodes, int programCode, int sectorCode, int subSectorCode, int subSector2Code, int categoryCode, int advertiserCode, int brandCode, int productCode, int prodVersionCode, int agencyCode, int sTime, int eTime, int sDuration, int eDuration, int posInBreak, int sPrice, int ePrice, bool fa, ObjectDataSourceSelectingEventArgs e, string sortColumn, int maximumRows, int startRowIndex)
        {
            int page = startRowIndex + 1 > maximumRows ? ((startRowIndex / maximumRows) + 1) : 1;

            mediaCodes = mediaCodes != null ? mediaCodes : "";

            DataTable dt = SPs.GetReportCommercialPaged(userID, page, maximumRows, sortColumn, sDate, eDate.AddDays(0), mediaTypeCode, mediaCodes, programCode, sectorCode, subSectorCode, subSector2Code, categoryCode, advertiserCode, brandCode, productCode, prodVersionCode, agencyCode, sTime, eTime, sDuration, eDuration, posInBreak, sPrice, ePrice, fa).GetDataSet().Tables[0];


            int totalRecords = 0;

            if (dt.Rows.Count > 0)
                totalRecords = Utility.ToInt(dt.Rows[0]["TotalRecords"]);

            e.Arguments.TotalRowCount = totalRecords;

            return dt;
        }

        public int GetReportTVCR_RowCount(int userID, DateTime sDate, DateTime eDate, int mediaTypeCode, string mediaCodes, int programCode, int sectorCode, int subSectorCode, int subSector2Code, int categoryCode, int advertiserCode, int brandCode, int productCode, int prodVersionCode, int agencyCode, int sTime, int eTime, int sDuration, int eDuration, int posInBreak, int sPrice, int ePrice, bool fa, ObjectDataSourceSelectingEventArgs e)
        {
            return e.Arguments.TotalRowCount;
        }
        public DataTable GetReportTVCR_Paged2(int userID, int sDate, int eDate, int mediaTypeCode, string mediaCodes, int programCode, int sectorCode, int subSectorCode, int subSector2Code, int categoryCode, int advertiserCode, int brandCode, int productCode, int prodVersionCode, int agencyCode, int sTime, int eTime, int sDuration, int eDuration, int posInBreak, int sPrice, int ePrice, bool fa, ObjectDataSourceSelectingEventArgs e, string sortColumn, int maximumRows, int startRowIndex)
        {
            int page = startRowIndex + 1 > maximumRows ? ((startRowIndex / maximumRows) + 1) : 1;

            mediaCodes = mediaCodes != null ? mediaCodes : "";

            DataTable dt = SPs.GetReportCommercialPaged2(userID, page, maximumRows, sortColumn, sDate, eDate, mediaTypeCode, mediaCodes, programCode, sectorCode, subSectorCode, subSector2Code, categoryCode, advertiserCode, brandCode, productCode, prodVersionCode, agencyCode, sTime, eTime, sDuration, eDuration, posInBreak, sPrice, ePrice, fa).GetDataSet().Tables[0];


            int totalRecords = 0;

            if (dt.Rows.Count > 0)
                totalRecords = Utility.ToInt(dt.Rows[0]["TotalRecords"]);

            e.Arguments.TotalRowCount = totalRecords;

            return dt;
        }

        public int GetReportTVCR_RowCount2(int userID, int sDate, int eDate, int mediaTypeCode, string mediaCodes, int programCode, int sectorCode, int subSectorCode, int subSector2Code, int categoryCode, int advertiserCode, int brandCode, int productCode, int prodVersionCode, int agencyCode, int sTime, int eTime, int sDuration, int eDuration, int posInBreak, int sPrice, int ePrice, bool fa, ObjectDataSourceSelectingEventArgs e)
        {
            return e.Arguments.TotalRowCount;
        }

        public DataTable GetReportTVCR_Export(int userID, DateTime sDate, DateTime eDate, int mediaTypeCode, string mediaCodes, int programCode, int sectorCode, int subSectorCode, int subSector2Code, int categoryCode, int advertiserCode, int brandCode, int productCode, int prodVersionCode, int agencyCode, int sTime, int eTime, int sDuration, int eDuration, int posInBreak, int sPrice, int ePrice, bool fa, ObjectDataSourceSelectingEventArgs e, string sortColumn, int maximumRows, int startRowIndex)
        {
            int page = startRowIndex + 1 > maximumRows ? ((startRowIndex / maximumRows) + 1) : 1;

            mediaCodes = mediaCodes != null ? mediaCodes : "";

            DataTable dt = SPs.GetReportCommercialExport(userID, page, maximumRows, sortColumn, sDate, eDate.AddDays(0), mediaTypeCode, mediaCodes, programCode, sectorCode, subSectorCode, subSector2Code, categoryCode, advertiserCode, brandCode, productCode, prodVersionCode, agencyCode, sTime, eTime, sDuration, eDuration, posInBreak, sPrice, ePrice, fa).GetDataSet().Tables[0];


            int totalRecords = 0;

            if (dt.Rows.Count > 0)
                totalRecords = Utility.ToInt(dt.Rows[0]["TotalRecords"]);

            e.Arguments.TotalRowCount = totalRecords;

            return dt;
        }
        public DataTable GetReportTVCR_Export2(int userID, int sDate, int eDate, int mediaTypeCode, string mediaCodes, int programCode, int sectorCode, int subSectorCode, int subSector2Code, int categoryCode, int advertiserCode, int brandCode, int productCode, int prodVersionCode, int agencyCode, int sTime, int eTime, int sDuration, int eDuration, int posInBreak, int sPrice, int ePrice, bool fa, ObjectDataSourceSelectingEventArgs e, string sortColumn, int maximumRows, int startRowIndex)
        {
            int page = startRowIndex + 1 > maximumRows ? ((startRowIndex / maximumRows) + 1) : 1;

            mediaCodes = mediaCodes != null ? mediaCodes : "";

            DataTable dt = SPs.GetReportCommercialPagedExport2(userID, page, maximumRows, sortColumn, sDate, eDate, mediaTypeCode, mediaCodes, programCode, sectorCode, subSectorCode, subSector2Code, categoryCode, advertiserCode, brandCode, productCode, prodVersionCode, agencyCode, sTime, eTime, sDuration, eDuration, posInBreak, sPrice, ePrice, fa).GetDataSet().Tables[0];


            int totalRecords = 0;

            if (dt.Rows.Count > 0)
                totalRecords = Utility.ToInt(dt.Rows[0]["TotalRecords"]);

            e.Arguments.TotalRowCount = totalRecords;

            return dt;
        }
        public int GetReportTVCR_RowCountExport(int userID, DateTime sDate, DateTime eDate, int mediaTypeCode, string mediaCodes, int programCode, int sectorCode, int subSectorCode, int subSector2Code, int categoryCode, int advertiserCode, int brandCode, int productCode, int prodVersionCode, int agencyCode, int sTime, int eTime, int sDuration, int eDuration, int posInBreak, int sPrice, int ePrice, bool fa, ObjectDataSourceSelectingEventArgs e)
        {
            return e.Arguments.TotalRowCount;
        }
        public int GetReportTVCR_RowCountExport2(int userID, int sDate, int eDate, int mediaTypeCode, string mediaCodes, int programCode, int sectorCode, int subSectorCode, int subSector2Code, int categoryCode, int advertiserCode, int brandCode, int productCode, int prodVersionCode, int agencyCode, int sTime, int eTime, int sDuration, int eDuration, int posInBreak, int sPrice, int ePrice, bool fa, ObjectDataSourceSelectingEventArgs e)
        {
            return e.Arguments.TotalRowCount;
        }

        public DataTable GetReportTVCR_Count(int userID, DateTime sDate, DateTime eDate, int mediaTypeCode, string mediaCodes, int programCode, int sectorCode, int subSectorCode, int subSector2Code, int categoryCode, int advertiserCode, int brandCode, int productCode, int prodVersionCode, int agencyCode, int sTime, int eTime, int sDuration, int eDuration, int posInBreak, int sPrice, int ePrice, bool fa, ObjectDataSourceSelectingEventArgs e, string sortColumn, int maximumRows, int startRowIndex)
        {
            int page = startRowIndex + 1 > maximumRows ? ((startRowIndex / maximumRows) + 1) : 1;

            mediaCodes = mediaCodes != null ? mediaCodes : "";

            DataTable dt = SPs.GetReportCommercialCount(userID, page, maximumRows, sortColumn, sDate, eDate.AddDays(0), mediaTypeCode, mediaCodes, programCode, sectorCode, subSectorCode, subSector2Code, categoryCode, advertiserCode, brandCode, productCode, prodVersionCode, agencyCode, sTime, eTime, sDuration, eDuration, posInBreak, sPrice, ePrice, fa).GetDataSet().Tables[0];


            int totalRecords = 0;

            if (dt.Rows.Count > 0)
                totalRecords = Utility.ToInt(dt.Rows[0]["CountRecord"]);

            e.Arguments.TotalRowCount = totalRecords;

            return dt;
        }
        public DataTable GetReportTVCR_Count2(int userID, int sDate, int eDate, int mediaTypeCode, string mediaCodes, int programCode, int sectorCode, int subSectorCode, int subSector2Code, int categoryCode, int advertiserCode, int brandCode, int productCode, int prodVersionCode, int agencyCode, int sTime, int eTime, int sDuration, int eDuration, int posInBreak, int sPrice, int ePrice, bool fa, ObjectDataSourceSelectingEventArgs e, string sortColumn, int maximumRows, int startRowIndex)
        {
            int page = startRowIndex + 1 > maximumRows ? ((startRowIndex / maximumRows) + 1) : 1;

            mediaCodes = mediaCodes != null ? mediaCodes : "";

            DataTable dt = SPs.GetReportCommercialCount2(userID, page, maximumRows, sortColumn, sDate, eDate, mediaTypeCode, mediaCodes, programCode, sectorCode, subSectorCode, subSector2Code, categoryCode, advertiserCode, brandCode, productCode, prodVersionCode, agencyCode, sTime, eTime, sDuration, eDuration, posInBreak, sPrice, ePrice, fa).GetDataSet().Tables[0];


            int totalRecords = 0;

            if (dt.Rows.Count > 0)
                totalRecords = Utility.ToInt(dt.Rows[0]["CountRecord"]);

            e.Arguments.TotalRowCount = totalRecords;

            return dt;
        }
        public int GetReportTVCR_RowCountTotal2(int userID, int sDate, int eDate, int mediaTypeCode, string mediaCodes, int programCode, int sectorCode, int subSectorCode, int subSector2Code, int categoryCode, int advertiserCode, int brandCode, int productCode, int prodVersionCode, int agencyCode, int sTime, int eTime, int sDuration, int eDuration, int posInBreak, int sPrice, int ePrice, bool fa, ObjectDataSourceSelectingEventArgs e)
        {
            return e.Arguments.TotalRowCount;
        }
        public int GetReportTVCR_RowCountTotal(int userID, DateTime sDate, DateTime eDate, int mediaTypeCode, string mediaCodes, int programCode, int sectorCode, int subSectorCode, int subSector2Code, int categoryCode, int advertiserCode, int brandCode, int productCode, int prodVersionCode, int agencyCode, int sTime, int eTime, int sDuration, int eDuration, int posInBreak, int sPrice, int ePrice, bool fa, ObjectDataSourceSelectingEventArgs e)
        {
            return e.Arguments.TotalRowCount;
        }


        #endregion


        #region PRESS

        public DataTable GetReportPress_Paged(int userID, DateTime sDate, DateTime eDate, int mediaTypeCode, string mediaCodes, int sectorCode, int subSectorCode, int subSector2Code, int categoryCode, int advertiserCode, int brandCode, int productCode, int prodVersionCode, int agencyCode, int sPrice, int ePrice, bool fa, ObjectDataSourceSelectingEventArgs e, string sortColumn, int maximumRows, int startRowIndex)
        {
            int page = startRowIndex + 1 > maximumRows ? ((startRowIndex / maximumRows) + 1) : 1;

            mediaCodes = mediaCodes != null ? mediaCodes : "";

            DataTable dt = SPs.GetReportPressPaged(userID, page, maximumRows, sortColumn, sDate, eDate.AddDays(0), mediaTypeCode, mediaCodes, sectorCode, subSectorCode, subSector2Code, categoryCode, advertiserCode, brandCode, productCode, prodVersionCode, agencyCode, sPrice, ePrice, fa).GetDataSet().Tables[0];


            int totalRecords = 0;

            if (dt.Rows.Count > 0)
                totalRecords = Utility.ToInt(dt.Rows[0]["TotalRecords"]);

            e.Arguments.TotalRowCount = totalRecords;

            return dt;
        }

        public int GetReportPress_RowCount(int userID, DateTime sDate, DateTime eDate, int mediaTypeCode, string mediaCodes, int sectorCode, int subSectorCode, int subSector2Code, int categoryCode, int advertiserCode, int brandCode, int productCode, int prodVersionCode, int agencyCode, int sPrice, int ePrice, bool fa, ObjectDataSourceSelectingEventArgs e)
        {
            return e.Arguments.TotalRowCount;
        }


        public DataTable GetReportPress_Export(int userID, DateTime sDate, DateTime eDate, int mediaTypeCode, string mediaCodes, int sectorCode, int subSectorCode, int subSector2Code, int categoryCode, int advertiserCode, int brandCode, int productCode, int prodVersionCode, int agencyCode, int sPrice, int ePrice, bool fa, ObjectDataSourceSelectingEventArgs e, string sortColumn, int maximumRows, int startRowIndex)
        {
            int page = startRowIndex + 1 > maximumRows ? ((startRowIndex / maximumRows) + 1) : 1;

            mediaCodes = mediaCodes != null ? mediaCodes : "";

            DataTable dt = SPs.GetReportPressPagedExport(userID, page, maximumRows, sortColumn, sDate, eDate.AddDays(0), mediaTypeCode, mediaCodes, sectorCode, subSectorCode, subSector2Code, categoryCode, advertiserCode, brandCode, productCode, prodVersionCode, agencyCode, sPrice, ePrice, fa).GetDataSet().Tables[0];


            int totalRecords = 0;

            if (dt.Rows.Count > 0)
                totalRecords = Utility.ToInt(dt.Rows[0]["TotalRecords"]);

            e.Arguments.TotalRowCount = totalRecords;

            return dt;
        }

        public int GetReportPress_RowCountExport(int userID, DateTime sDate, DateTime eDate, int mediaTypeCode, string mediaCodes, int sectorCode, int subSectorCode, int subSector2Code, int categoryCode, int advertiserCode, int brandCode, int productCode, int prodVersionCode, int agencyCode, int sPrice, int ePrice, bool fa, ObjectDataSourceSelectingEventArgs e)
        {
            return e.Arguments.TotalRowCount;
        }


        public DataTable GetReportPress_Count(int userID, DateTime sDate, DateTime eDate, int mediaTypeCode, string mediaCodes, int sectorCode, int subSectorCode, int subSector2Code, int categoryCode, int advertiserCode, int brandCode, int productCode, int prodVersionCode, int agencyCode, int sPrice, int ePrice, bool fa, ObjectDataSourceSelectingEventArgs e, string sortColumn, int maximumRows, int startRowIndex)
        {
            int page = startRowIndex + 1 > maximumRows ? ((startRowIndex / maximumRows) + 1) : 1;

            mediaCodes = mediaCodes != null ? mediaCodes : "";

            DataTable dt = SPs.GetReportPressCount(userID, page, maximumRows, sortColumn, sDate, eDate.AddDays(0), mediaTypeCode, mediaCodes, sectorCode, subSectorCode, subSector2Code, categoryCode, advertiserCode, brandCode, productCode, prodVersionCode, agencyCode, sPrice, ePrice, fa).GetDataSet().Tables[0];


            int totalRecords = 0;

            if (dt.Rows.Count > 0)
                totalRecords = Utility.ToInt(dt.Rows[0]["CountRecord"]);

            e.Arguments.TotalRowCount = totalRecords;

            return dt;
        }

        public int GetReportPress_RowCountTotal(int userID, DateTime sDate, DateTime eDate, int mediaTypeCode, string mediaCodes, int sectorCode, int subSectorCode, int subSector2Code, int categoryCode, int advertiserCode, int brandCode, int productCode, int prodVersionCode, int agencyCode, int sPrice, int ePrice, bool fa, ObjectDataSourceSelectingEventArgs e)
        {
            return e.Arguments.TotalRowCount;
        }

        #endregion


        #region OUTDOOR

        public DataTable GetReportOutdoor_Paged(int userID, DateTime sDate, DateTime eDate, int mediaTypeCode, string mediaCodes, int sectorCode, int subSectorCode, int categoryCode, int advertiserCode, int brandCode, int productCode, int prodVersionCode, int agencyCode, int sPrice, int ePrice, int size, string quality, int typeOfAds, bool fa, ObjectDataSourceSelectingEventArgs e, string sortColumn, int maximumRows, int startRowIndex)
        {
            int page = startRowIndex + 1 > maximumRows ? ((startRowIndex / maximumRows) + 1) : 1;

            mediaCodes = mediaCodes != null ? mediaCodes : "";
            quality = quality != null ? quality : "";


            DataTable dt = SPs.GetReportOutDoorPaged(userID, page, maximumRows, sortColumn, sDate, eDate.AddDays(1), mediaTypeCode, mediaCodes, sectorCode, subSectorCode, categoryCode, advertiserCode, brandCode, productCode, prodVersionCode, agencyCode, sPrice, ePrice, size, quality, typeOfAds, fa).GetDataSet().Tables[0];


            int totalRecords = 0;

            if (dt.Rows.Count > 0)
                totalRecords = Utility.ToInt(dt.Rows[0]["TotalRecords"]);

            e.Arguments.TotalRowCount = totalRecords;

            return dt;
        }

        public int GetReportOutdoor_RowCount(int userID, DateTime sDate, DateTime eDate, int mediaTypeCode, string mediaCodes, int sectorCode, int subSectorCode, int categoryCode, int advertiserCode, int brandCode, int productCode, int prodVersionCode, int agencyCode, int sPrice, int ePrice, int size, string quality, int typeOfAds, bool fa, ObjectDataSourceSelectingEventArgs e)
        {
            return e.Arguments.TotalRowCount;
        }


        public DataTable GetReportOutdoor_Export(int userID, DateTime sDate, DateTime eDate, int mediaTypeCode, string mediaCodes, int sectorCode, int subSectorCode, int categoryCode, int advertiserCode, int brandCode, int productCode, int prodVersionCode, int agencyCode, int sPrice, int ePrice, int size, string quality, int typeOfAds, bool fa, ObjectDataSourceSelectingEventArgs e, string sortColumn, int maximumRows, int startRowIndex)
        {
            int page = startRowIndex + 1 > maximumRows ? ((startRowIndex / maximumRows) + 1) : 1;

            mediaCodes = mediaCodes != null ? mediaCodes : "";
            quality = quality != null ? quality : "";


            DataTable dt = SPs.GetReportOutDoorPagedExport(userID, page, maximumRows, sortColumn, sDate, eDate.AddDays(1), mediaTypeCode, mediaCodes, sectorCode, subSectorCode, categoryCode, advertiserCode, brandCode, productCode, prodVersionCode, agencyCode, sPrice, ePrice, size, quality, typeOfAds, fa).GetDataSet().Tables[0];


            int totalRecords = 0;

            if (dt.Rows.Count > 0)
                totalRecords = Utility.ToInt(dt.Rows[0]["TotalRecords"]);

            e.Arguments.TotalRowCount = totalRecords;

            return dt;
        }

        public int GetReportOutdoor_RowCountExport(int userID, DateTime sDate, DateTime eDate, int mediaTypeCode, string mediaCodes, int sectorCode, int subSectorCode, int categoryCode, int advertiserCode, int brandCode, int productCode, int prodVersionCode, int agencyCode, int sPrice, int ePrice, int size, string quality, int typeOfAds, bool fa, ObjectDataSourceSelectingEventArgs e)
        {
            return e.Arguments.TotalRowCount;
        }


        public DataTable GetReportOutdoor_Count(int userID, DateTime sDate, DateTime eDate, int mediaTypeCode, string mediaCodes, int sectorCode, int subSectorCode, int categoryCode, int advertiserCode, int brandCode, int productCode, int prodVersionCode, int agencyCode, int sPrice, int ePrice, int size, string quality, int typeOfAds, bool fa, ObjectDataSourceSelectingEventArgs e, string sortColumn, int maximumRows, int startRowIndex)
        {
            int page = startRowIndex + 1 > maximumRows ? ((startRowIndex / maximumRows) + 1) : 1;

            mediaCodes = mediaCodes != null ? mediaCodes : "";
            quality = quality != null ? quality : "";


            DataTable dt = SPs.GetReportOutDoorCount(userID, page, maximumRows, sortColumn, sDate, eDate.AddDays(1), mediaTypeCode, mediaCodes, sectorCode, subSectorCode, categoryCode, advertiserCode, brandCode, productCode, prodVersionCode, agencyCode, sPrice, ePrice, size, quality, typeOfAds, fa).GetDataSet().Tables[0];


            int totalRecords = 0;

            if (dt.Rows.Count > 0)
                totalRecords = Utility.ToInt(dt.Rows[0]["CountRecord"]);

            e.Arguments.TotalRowCount = totalRecords;

            return dt;
        }

        public int GetReportOutdoor_RowCountTotal(int userID, DateTime sDate, DateTime eDate, int mediaTypeCode, string mediaCodes, int sectorCode, int subSectorCode, int categoryCode, int advertiserCode, int brandCode, int productCode, int prodVersionCode, int agencyCode, int sPrice, int ePrice, int size, string quality, int typeOfAds, bool fa, ObjectDataSourceSelectingEventArgs e)
        {
            return e.Arguments.TotalRowCount;
        }


        #endregion


        #region NEWS

        public DataSet GetReportNews_PDF(int userID, DateTime sDate, DateTime eDate, int mediaTypeCode, string mediaCodes, int sectorCode, int subSectorCode, int categoryCode, int advertiserCode, int productCode, int sPrice, int ePrice, int sectionCode, int newsTypeCode, string newsMediaType, bool fa)
        {

            mediaCodes = mediaCodes != null ? mediaCodes : "";
            newsMediaType = newsMediaType != null ? newsMediaType : "";


            //DataSet ds = SPs.GetReportNewsPdf (userID, sDate, eDate.AddDays(1), mediaTypeCode, mediaCodes, newsMediaType, newsTypeCode, sectionCode, sectorCode, subSectorCode, categoryCode, advertiserCode, productCode, sPrice, ePrice, fa).GetDataSet();
            DataSet ds = SPs.GetReportNewsPdf(userID, sDate, eDate, mediaTypeCode, mediaCodes, newsMediaType, newsTypeCode, sectionCode, sectorCode, subSectorCode, categoryCode, advertiserCode, productCode, sPrice, ePrice, fa).GetDataSet();
            return ds;
        }

        public DataTable GetReportNews(int userID, DateTime sDate, DateTime eDate, int mediaTypeCode, string mediaCodes, int sectorCode, int subSectorCode, int categoryCode, int advertiserCode, int productCode, int sPrice, int ePrice, int sectionCode, int newsTypeCode, string newsMediaType, bool fa, ObjectDataSourceSelectingEventArgs e, string sortColumn, int maximumRows, int startRowIndex)
        {
            int page = startRowIndex + 1 > maximumRows ? ((startRowIndex / maximumRows) + 1) : 1;

            mediaCodes = mediaCodes != null ? mediaCodes : "";
            newsMediaType = newsMediaType != null ? newsMediaType : "";


            DataTable dt = SPs.GetReportNewsPaged(userID, page, maximumRows, sortColumn, sDate, eDate.AddDays(1), mediaTypeCode, mediaCodes, newsMediaType, newsTypeCode, sectionCode, sectorCode, subSectorCode, categoryCode, advertiserCode, productCode, sPrice, ePrice, fa).GetDataSet().Tables[0];


            int totalRecords = 0;

            if (dt.Rows.Count > 0)
                totalRecords = Utility.ToInt(dt.Rows[0]["TotalRecords"]);

            e.Arguments.TotalRowCount = totalRecords;

            return dt;
        }

        public int GetReportNews_RowCount(int userID, DateTime sDate, DateTime eDate, int mediaTypeCode, string mediaCodes, int sectorCode, int subSectorCode, int categoryCode, int advertiserCode, int productCode, int sPrice, int ePrice, int sectionCode, int newsTypeCode, string newsMediaType, bool fa, ObjectDataSourceSelectingEventArgs e)
        {
            return e.Arguments.TotalRowCount;
        }


        #endregion


        #region[New Commercial]
        public DataSet GetReportCommercialPdf(int CompanyCode, DateTime sDate, DateTime eDate)
        {

            DataSet ds = SPs.GetReportCommercialPdf(CompanyCode, sDate, eDate).GetDataSet();
            return ds;
        }
        public DataSet GetReportNewCommercialAllPDF(int CompanyCode, string sDate, string eDate, bool pdf)
        {
            DataSet ds = SPs.GetReportNewCommercialAllPDF(CompanyCode, sDate, eDate,pdf).GetDataSet();
            return ds;
        
        }

        public DataSet GetReportNewsAdminPdf(int CompanyCode, DateTime sDate, DateTime eDate,int sc,int ssc,int cc,bool filter)
        {

            DataSet ds = SPs.GetReportNewsAdminPdf(CompanyCode, sDate, eDate, sc, ssc, cc, filter).GetDataSet();
            return ds;
        }
        #endregion


        #region INTERNET

        public DataTable GetReportInternet_Paged(int userID, DateTime sDate, DateTime eDate, int mediaTypeCode, string mediaCodes, int sectorCode, int subSectorCode, int subSector2Code, int categoryCode, int advertiserCode, int brandCode, int productCode, int prodVersionCode, int agencyCode, int sPrice, int ePrice, bool fa, ObjectDataSourceSelectingEventArgs e, string sortColumn, int maximumRows, int startRowIndex)
        {
            int page = startRowIndex + 1 > maximumRows ? ((startRowIndex / maximumRows) + 1) : 1;

            mediaCodes = mediaCodes != null ? mediaCodes : "";

            DataTable dt = SPs.GetReportInternetPaged(userID, page, maximumRows, sortColumn, sDate, eDate.AddDays(0), mediaTypeCode, mediaCodes, sectorCode, subSectorCode, subSector2Code, categoryCode, advertiserCode, brandCode, productCode, prodVersionCode, agencyCode, sPrice, ePrice, fa).GetDataSet().Tables[0];


            int totalRecords = 0;

            if (dt.Rows.Count > 0)
                totalRecords = Utility.ToInt(dt.Rows[0]["TotalRecords"]);

            e.Arguments.TotalRowCount = totalRecords;

            return dt;
        }

        public int GetReportInternet_RowCount(int userID, DateTime sDate, DateTime eDate, int mediaTypeCode, string mediaCodes, int sectorCode, int subSectorCode, int subSector2Code, int categoryCode, int advertiserCode, int brandCode, int productCode, int prodVersionCode, int agencyCode, int sPrice, int ePrice, bool fa, ObjectDataSourceSelectingEventArgs e)
        {
            return e.Arguments.TotalRowCount;
        }

        public DataTable GetReportInternet_Count(int userID, DateTime sDate, DateTime eDate, int mediaTypeCode, string mediaCodes, int sectorCode, int subSectorCode, int subSector2Code, int categoryCode, int advertiserCode, int brandCode, int productCode, int prodVersionCode, int agencyCode, int sPrice, int ePrice, bool fa, ObjectDataSourceSelectingEventArgs e, string sortColumn, int maximumRows, int startRowIndex)
        {
            int page = startRowIndex + 1 > maximumRows ? ((startRowIndex / maximumRows) + 1) : 1;

            mediaCodes = mediaCodes != null ? mediaCodes : "";

            DataTable dt = SPs.GetReportInternetCount(userID, page, maximumRows, sortColumn, sDate, eDate.AddDays(0), mediaTypeCode, mediaCodes, sectorCode, subSectorCode, subSector2Code, categoryCode, advertiserCode, brandCode, productCode, prodVersionCode, agencyCode, sPrice, ePrice, fa).GetDataSet().Tables[0];


            int totalRecords = 0;

            if (dt.Rows.Count > 0)
                totalRecords = Utility.ToInt(dt.Rows[0]["CountRecord"]);

            e.Arguments.TotalRowCount = totalRecords;

            return dt;
        }

        public int GetReportInternet_RowCountTotal(int userID, DateTime sDate, DateTime eDate, int mediaTypeCode, string mediaCodes, int sectorCode, int subSectorCode, int subSector2Code, int categoryCode, int advertiserCode, int brandCode, int productCode, int prodVersionCode, int agencyCode, int sPrice, int ePrice, bool fa, ObjectDataSourceSelectingEventArgs e)
        {
            return e.Arguments.TotalRowCount;
        }

        public DataTable GetReportInternet_Export(int userID, DateTime sDate, DateTime eDate, int mediaTypeCode, string mediaCodes, int sectorCode, int subSectorCode, int subSector2Code, int categoryCode, int advertiserCode, int brandCode, int productCode, int prodVersionCode, int agencyCode, int sPrice, int ePrice, bool fa, ObjectDataSourceSelectingEventArgs e, string sortColumn, int maximumRows, int startRowIndex)
        {
            int page = startRowIndex + 1 > maximumRows ? ((startRowIndex / maximumRows) + 1) : 1;

            mediaCodes = mediaCodes != null ? mediaCodes : "";

            DataTable dt = SPs.GetReportInternetPagedExport(userID, page, maximumRows, sortColumn, sDate, eDate.AddDays(0), mediaTypeCode, mediaCodes, sectorCode, subSectorCode, subSector2Code, categoryCode, advertiserCode, brandCode, productCode, prodVersionCode, agencyCode, sPrice, ePrice, fa).GetDataSet().Tables[0];


            int totalRecords = 0;

            if (dt.Rows.Count > 0)
                totalRecords = Utility.ToInt(dt.Rows[0]["TotalRecords"]);

            e.Arguments.TotalRowCount = totalRecords;

            return dt;
        }

        public int GetReportInternet_RowCountExport(int userID, DateTime sDate, DateTime eDate, int mediaTypeCode, string mediaCodes, int sectorCode, int subSectorCode, int subSector2Code, int categoryCode, int advertiserCode, int brandCode, int productCode, int prodVersionCode, int agencyCode, int sPrice, int ePrice, bool fa, ObjectDataSourceSelectingEventArgs e)
        {
            return e.Arguments.TotalRowCount;
        }



        #endregion


        #region [Planning]

        //public  static DataTable GetReportPlanning_Paged(int userID, DateTime sDate, DateTime eDate, int mediaTypeCode, string mediaCodes, ObjectDataSourceSelectingEventArgs e, string sortColumn, int maximumRows, int startRowIndex)
        public static DataTable GetReportPlanning_Paged(int userID, DateTime sDate, DateTime eDate, int mediaTypeCode, string mediaCodes, string sortColumn, int maximumRows, int startRowIndex)
        {
            int page = startRowIndex + 1 > maximumRows ? ((startRowIndex / maximumRows) + 1) : 1;
            mediaCodes = mediaCodes != null ? mediaCodes : "";
            DataTable dt = SPs.GetReportPlanningPaged(userID, page, maximumRows, sortColumn, sDate, eDate, mediaTypeCode, mediaCodes).GetDataSet().Tables[0];
            //int totalRecords = 0;
            //if (dt.Rows.Count > 0)
            //    totalRecords = Utility.ToInt(dt.Rows.Count);
            //totalRecords = Utility.ToInt(dt.Rows[0]["TotalRecords"]);
            //e.Arguments.TotalRowCount = totalRecords;
            return dt;
        }

        public int GetReportPlanning_RowCount(int userID, DateTime sDate, DateTime eDate, int mediaTypeCode, string mediaCodes, ObjectDataSourceSelectingEventArgs e)
        {
            return e.Arguments.TotalRowCount;
        }


        public DataTable GetReportPlanning_Export(int userID, DateTime sDate, DateTime eDate, int mediaTypeCode, string mediaCodes, ObjectDataSourceSelectingEventArgs e, string sortColumn, int maximumRows, int startRowIndex)
        {
            int page = startRowIndex + 1 > maximumRows ? ((startRowIndex / maximumRows) + 1) : 1;
            mediaCodes = mediaCodes != null ? mediaCodes : "";
            DataTable dt = SPs.GetReportPlanningExport(userID, page, maximumRows, sortColumn, sDate, eDate, mediaTypeCode, mediaCodes).GetDataSet().Tables[0];
            int totalRecords = 0;
            if (dt.Rows.Count > 0)
                totalRecords = Utility.ToInt(dt.Rows[0]["TotalRecords"]);
            e.Arguments.TotalRowCount = totalRecords;
            return dt;
        }

        public int GetReportPlanning_RowCountExport(int userID, DateTime sDate, DateTime eDate, int mediaTypeCode, string mediaCodes, ObjectDataSourceSelectingEventArgs e)
        {
            return e.Arguments.TotalRowCount;
        }


        #endregion


        #region [Competition]
        public DataTable GetReportAll_Competition(int userID, DateTime sDate, DateTime eDate, bool searchTV, bool searchRD, bool searchCB, bool searchPR, bool searchOD, string mediaCodes, string sectorName, string subSectorName, string categoryName, string brandName,int MediaTypeCode, bool searchIN, string brandNames, ObjectDataSourceSelectingEventArgs e, string sortColumn, int maximumRows, int startRowIndex)
        {
            int page = startRowIndex + 1 > maximumRows ? ((startRowIndex / maximumRows) + 1) : 1;

            mediaCodes = mediaCodes != null ? mediaCodes : "";
            sectorName = sectorName != null ? sectorName : "";
            subSectorName = subSectorName != null ? subSectorName : "";
            categoryName = categoryName != null ? categoryName : "";
            brandName = brandName != null ? brandName : "";
            brandNames = brandNames != null ? brandNames : "";

            DataTable dt = SPs.GetReportAllCompetition(userID, page, maximumRows, sortColumn, sDate, eDate.AddDays(0), searchTV, searchRD, searchCB, searchPR, searchOD, mediaCodes, sectorName, subSectorName, categoryName, brandName, MediaTypeCode, searchIN, brandNames).GetDataSet().Tables[0];


            int totalRecords = 0;

            if (dt.Rows.Count > 0)
                totalRecords = Utility.ToInt(dt.Rows[0]["TotalRecords"]);

            e.Arguments.TotalRowCount = totalRecords;

            return dt;
        }
        public int GetReportCompetition_RowCount(int userID, DateTime sDate, DateTime eDate, bool searchTV, bool searchRD, bool searchCB, bool searchPR, bool searchOD, string mediaCodes, string sectorName, string subSectorName, string categoryName, string brandName, int MediaTypeCode, bool searchIN, string brandNames, ObjectDataSourceSelectingEventArgs e)
        {
            return e.Arguments.TotalRowCount;
        }


        public DataTable GetReportAll_CompetitionGraph(int userID, DateTime sDate, DateTime eDate, bool searchTV, bool searchRD, bool searchCB, bool searchPR, bool searchOD, string mediaCodes, string sectorName, string subSectorName, string categoryName, string brandName, int MediaTypeCode, bool searchIN, string brandNames, ObjectDataSourceSelectingEventArgs e, string sortColumn, int maximumRows, int startRowIndex)
        {
            int page = startRowIndex + 1 > maximumRows ? ((startRowIndex / maximumRows) + 1) : 1;

            mediaCodes = mediaCodes != null ? mediaCodes : "";
            sectorName = sectorName != null ? sectorName : "";
            subSectorName = subSectorName != null ? subSectorName : "";
            categoryName = categoryName != null ? categoryName : "";
            brandName = brandName != null ? brandName : "";
            brandNames = brandNames != null ? brandNames : "";

            DataTable dt = SPs.GetReportAllCompetitionGraph(userID, page, maximumRows, sortColumn, sDate, eDate.AddDays(0), searchTV, searchRD, searchCB, searchPR, searchOD, mediaCodes, sectorName, subSectorName, categoryName, brandName, MediaTypeCode, searchIN, brandNames).GetDataSet().Tables[0];


            int totalRecords = 0;

            if (dt.Rows.Count > 0)
                totalRecords = Utility.ToInt(dt.Rows[0]["TotalRecords"]);

            e.Arguments.TotalRowCount = totalRecords;

            return dt;
        }
        public int GetReportCompetition_RowCountGraph(int userID, DateTime sDate, DateTime eDate, bool searchTV, bool searchRD, bool searchCB, bool searchPR, bool searchOD, string mediaCodes, string sectorName, string subSectorName, string categoryName, string brandName, int MediaTypeCode, bool searchIN, string brandNames, ObjectDataSourceSelectingEventArgs e)
        {
            return e.Arguments.TotalRowCount;
        }


        public DataTable GetReportAll_Insertions(int userID, DateTime sDate, DateTime eDate, bool searchTV, bool searchRD, bool searchCB, bool searchPR, bool searchOD, string mediaCodes, string sectorName, string subSectorName, string categoryName, string brandName, int MediaTypeCode, bool searchIN, string brandNames, ObjectDataSourceSelectingEventArgs e, string sortColumn, int maximumRows, int startRowIndex)
        {
            int page = startRowIndex + 1 > maximumRows ? ((startRowIndex / maximumRows) + 1) : 1;

            mediaCodes = mediaCodes != null ? mediaCodes : "";
            sectorName = sectorName != null ? sectorName : "";
            subSectorName = subSectorName != null ? subSectorName : "";
            categoryName = categoryName != null ? categoryName : "";
            brandName = brandName != null ? brandName : "";
            brandNames = brandNames != null ? brandNames : "";

            DataTable dt = SPs.GetReportAllInsertions(userID, page, maximumRows, sortColumn, sDate, eDate.AddDays(0), searchTV, searchRD, searchCB, searchPR, searchOD, mediaCodes, sectorName, subSectorName, categoryName, brandName, MediaTypeCode, searchIN, brandNames).GetDataSet().Tables[0];


            int totalRecords = 0;

            if (dt.Rows.Count > 0)
                totalRecords = Utility.ToInt(dt.Rows[0]["TotalRecords"]);

            e.Arguments.TotalRowCount = totalRecords;

            return dt;
        }
        public int GetReportInsertions_RowCount(int userID, DateTime sDate, DateTime eDate, bool searchTV, bool searchRD, bool searchCB, bool searchPR, bool searchOD, string mediaCodes, string sectorName, string subSectorName, string categoryName, string brandName, int MediaTypeCode, bool searchIN, string brandNames, ObjectDataSourceSelectingEventArgs e)
        {
            return e.Arguments.TotalRowCount;
        }


        public DataTable GetReportAll_InsertionsGraph(int userID, DateTime sDate, DateTime eDate, bool searchTV, bool searchRD, bool searchCB, bool searchPR, bool searchOD, string mediaCodes, string sectorName, string subSectorName, string categoryName, string brandName, int MediaTypeCode, bool searchIN, string brandNames, ObjectDataSourceSelectingEventArgs e, string sortColumn, int maximumRows, int startRowIndex)
        {
            int page = startRowIndex + 1 > maximumRows ? ((startRowIndex / maximumRows) + 1) : 1;

            mediaCodes = mediaCodes != null ? mediaCodes : "";
            sectorName = sectorName != null ? sectorName : "";
            subSectorName = subSectorName != null ? subSectorName : "";
            categoryName = categoryName != null ? categoryName : "";
            brandName = brandName != null ? brandName : "";
            brandNames = brandNames != null ? brandNames : "";

            DataTable dt = SPs.GetReportAllInsertionsGraph(userID, page, maximumRows, sortColumn, sDate, eDate.AddDays(0), searchTV, searchRD, searchCB, searchPR, searchOD, mediaCodes, sectorName, subSectorName, categoryName, brandName, MediaTypeCode, searchIN, brandNames).GetDataSet().Tables[0];


            int totalRecords = 0;

            if (dt.Rows.Count > 0)
                totalRecords = Utility.ToInt(dt.Rows[0]["TotalRecords"]);

            e.Arguments.TotalRowCount = totalRecords;

            return dt;
        }
        public int GetReportInsertions_RowCountGraph(int userID, DateTime sDate, DateTime eDate, bool searchTV, bool searchRD, bool searchCB, bool searchPR, bool searchOD, string mediaCodes, string sectorName, string subSectorName, string categoryName, string brandName, int MediaTypeCode, bool searchIN, string brandNames, ObjectDataSourceSelectingEventArgs e)
        {
            return e.Arguments.TotalRowCount;
        }

        #endregion

        public DataTable GetReportAll_NewsAlert(string code, string Date, string Calificacion, string Company, int? userid, ObjectDataSourceSelectingEventArgs e, string sortColumn, int maximumRows, int startRowIndex)
        {
            DataTable dt = SPs.GetReportNewsAlert(code, Date, Calificacion, Company, userid).GetDataSet().Tables[0];
            int totalRecords = 0;
            bool count = dt.Rows.Count <= 0;
            if (!count)
            {
                totalRecords = Utility.ToInt(dt.Rows[0]["Totalrecord"]);
            }
            e.Arguments.TotalRowCount = totalRecords;
            DataTable dataTable = dt;
            return dataTable;
        }
        public DataTable GetReportAll_NewsAlertToday(string code, string Date, string Calificacion, string Company, ObjectDataSourceSelectingEventArgs e, string sortColumn, int maximumRows, int startRowIndex)
        {
            DataTable dt = SPs.GetReportNewsAlertToday(code, Date, Calificacion, Company).GetDataSet().Tables[0];
            int totalRecords = 0;

            if (dt.Rows.Count > 0)
                totalRecords = Utility.ToInt(dt.Rows[0]["Totalrecord"]);

            e.Arguments.TotalRowCount = totalRecords;

            return dt;
        }
        public DataTable GetReportAll_NewsAlertChart(string code, string Date, string Calificacion, string Company, int? UserID)
        {
            DataTable dt = SPs.GetReportNewsAlert(code, Date, Calificacion, Company, UserID).GetDataSet().Tables[1];
            DataTable dataTable = dt;
            return dataTable;
        }
        public DataTable GetReportAll_NewsAlertChartToday(string code, string Date, string Calificacion, string Company)
        {
            DataTable dt = SPs.GetReportNewsAlertToday(code, Date, Calificacion, Company).GetDataSet().Tables[1];

            return dt;
        }
        public DataTable GetReportAll_NewsAlertDetail(string code, string Date, string Calificacion, string Company, int? UserID, ObjectDataSourceSelectingEventArgs e, string sortColumn, int maximumRows, int startRowIndex)
        {
            DataTable dt = SPs.GetReportNewsAlert(code, Date, Calificacion, Company, UserID).GetDataSet().Tables[2];
            int totalRecords = 0;
            bool count = dt.Rows.Count <= 0;
            if (!count)
            {
                totalRecords = Utility.ToInt(dt.Rows[0]["Totalrecord"]);
            }
            e.Arguments.TotalRowCount = totalRecords;
            DataTable dataTable = dt;
            return dataTable;
        }

        public DataTable GetReportAll_NewsAlertDetailToday(string code, string Date, string Calificacion, string Company, ObjectDataSourceSelectingEventArgs e, string sortColumn, int maximumRows, int startRowIndex)
        {
            DataTable dt = SPs.GetReportNewsAlertToday(code, Date, Calificacion, Company).GetDataSet().Tables[2];
           
            int totalRecords = 0;

            if (dt.Rows.Count > 0)
                totalRecords = Utility.ToInt(dt.Rows[0]["Totalrecord"]);

            e.Arguments.TotalRowCount = totalRecords;

            return dt;
        }
        public DataTable getReport_Comment(string code, string Date, string Calificacion, string Company, ObjectDataSourceSelectingEventArgs e, string sortColumn, int maximumRows, int startRowIndex)
        {
            DataTable dt = SPs.GetReportNewsAlertToday(code, Date, Calificacion, Company).GetDataSet().Tables[2];

            int totalRecords = 0;

            if (dt.Rows.Count > 0)
                totalRecords = Utility.ToInt(dt.Rows[0]["Totalrecord"]);

            e.Arguments.TotalRowCount = totalRecords;

            return dt;
        }
        public DataTable GetReport_NewsAlertOnDate(int UserID)
        {
            DataTable dt = SPs.GetReportNewsAlertOnDate(UserID).GetDataSet().Tables[0];

            return dt;
        }
        //public DataTable GetReportAll_NewsAlertAfterFilter(string Date1, string Date2, string mediaTypeName1, string AdvertiserName1, string NewsTitle1, string Calification1, string TitleNews, string Summary, string Text, ObjectDataSourceSelectingEventArgs e, string sortColumn, int maximumRows, int startRowIndex)
        //{
        //    DataTable dt = SPs.GetReportNewsAlertAfterFilter(Date1, Date2, mediaTypeName1, AdvertiserName1, NewsTitle1, Calification1, TitleNews, Summary, Text).GetDataSet().Tables[0];
        //    int totalRecords = 0;

        //    if (dt.Rows.Count > 0)
        //        totalRecords = Utility.ToInt(dt.Rows[0]["CountRecord"]);

        //    e.Arguments.TotalRowCount = totalRecords;

        //    return dt;
        //}

        public DataTable GetReportAll_NewsAlertAfterFilter(string Date1, string Date2, string mediaTypeName1, string AdvertiserName1, string NewsTitle1, string Calification1, string TitleNews, string Summary, string Text,string mediaCode,string AdvertiserMake, ObjectDataSourceSelectingEventArgs e, string sortColumn, int maximumRows, int startRowIndex)
        {
            DataTable dt = SPs.GetReportNewsAlertAfterFilter(Date1, Date2, mediaTypeName1, AdvertiserName1, NewsTitle1, Calification1, TitleNews, Summary, Text, mediaCode, AdvertiserMake).GetDataSet().Tables[0];
            int totalRecords = 0;

            if (dt.Rows.Count > 0)
                totalRecords = Utility.ToInt(dt.Rows[0]["CountRecord"]);

            e.Arguments.TotalRowCount = totalRecords;

            return dt;
        }

        public DataTable GetReportAll_NewsAlertChartAfterFilter(string Date1, string Date2, string mediaTypeName, string AdvertiserName, string NewsTitle, string Calification, string TitleNews, string Summary, string Text,string mediaCode,string AdvertiserMake)
        {
            DataTable dt = SPs.GetReportNewsAlertAfterFilter(Date1, Date2, mediaTypeName, AdvertiserName, NewsTitle, Calification, TitleNews, Summary, Text, mediaCode, AdvertiserMake).GetDataSet().Tables[1];

            return dt;
        }
        
        //public DataTable GetReportAll_NewsAlertDetailAfterFilter(string Date1, string Date2, string mediaTypeName1, string AdvertiserName1, string NewsTitle1, string Calification1, string TitleNews, string Summary, string Text, ObjectDataSourceSelectingEventArgs e, string sortColumn, int maximumRows, int startRowIndex)
        //{
        //    DataTable dt = SPs.GetReportNewsAlertAfterFilter(Date1, Date2, mediaTypeName1, AdvertiserName1, NewsTitle1, Calification1, TitleNews, Summary, Text).GetDataSet().Tables[2];

        //    int totalRecords = 0;

        //    if (dt.Rows.Count > 0)
        //        totalRecords = Utility.ToInt(dt.Rows[0]["Totalrecord"]);

        //    e.Arguments.TotalRowCount = totalRecords;

        //    return dt;
        //}

        public DataTable GetReportAll_NewsAlertDetailAfterFilter(string Date1, string Date2, string mediaTypeName1, string AdvertiserName1, string NewsTitle1, string Calification1, string TitleNews, string Summary, string Text, string mediaCode,string AdvertiserMake, ObjectDataSourceSelectingEventArgs e, string sortColumn, int maximumRows, int startRowIndex)
        {
            DataTable dt = SPs.GetReportNewsAlertAfterFilter(Date1, Date2, mediaTypeName1, AdvertiserName1, NewsTitle1, Calification1, TitleNews, Summary, Text, mediaCode, AdvertiserMake).GetDataSet().Tables[2];

            int totalRecords = 0;

            if (dt.Rows.Count > 0)
                totalRecords = Utility.ToInt(dt.Rows[0]["Totalrecord"]);

            e.Arguments.TotalRowCount = totalRecords;

            return dt;
        }

        public DataTable GETAdvertiserFORNewsAlert(int id)
        {
            DataTable dt = SPs.GETAdvertiserFORNewsAlert(id).GetDataSet().Tables[0];

            return dt;
        }
        public DataTable GETMediaTypeNameFORNewsAlert()
        {
            DataTable dt = SPs.GETMediaTypeNameFORNewsAlert().GetDataSet().Tables[0];

            return dt;
        }
        public DataTable GETMediaNameFORNewsAlert(int MediaTypecode)
        {
            DataTable dt = SPs.GETMediaNameFORNewsAlert(MediaTypecode).GetDataSet().Tables[0];

            return dt;
        }
        public DataTable getReport_Comment(string NewsID, ObjectDataSourceSelectingEventArgs e, string sortColumn, int maximumRows, int startRowIndex)
        {
            DataTable dt = SPs.getReportComment(NewsID).GetDataSet().Tables[0];

            int totalRecords = 0;

            if (dt.Rows.Count > 0)
                totalRecords = Utility.ToInt(dt.Rows[0]["CountRecord"]);

            e.Arguments.TotalRowCount = totalRecords;

            return dt;
        }
        public DataTable getReportReadNews_Comment(string ID, ObjectDataSourceSelectingEventArgs e, string sortColumn, int maximumRows, int startRowIndex)
        {
            DataTable dt = SPs.getReportReadNewsComment(ID).GetDataSet().Tables[0];

            int totalRecords = 0;

            if (dt.Rows.Count > 0)
                totalRecords = Utility.ToInt(dt.Rows[0]["CountRecord"]);

            e.Arguments.TotalRowCount = totalRecords;

            return dt;
        }
        public DataTable GetReportAllUser()
        {
            DataTable dt = SPs.GetReportAllUser().GetDataSet().Tables[0];
            return dt;
        }
        public DataTable GetReportAllRoles()
        {
            DataTable dt = SPs.GetReportAllUser().GetDataSet().Tables[1];
            return dt;
        }
        public DataTable GetUserIDAndRolle(string SiteUserID)
        {
            DataTable dt = SPs.GetLogedInUsersRole(Convert.ToInt32(SiteUserID)).GetDataSet().Tables[0];
            return dt;
        }
        public DataTable GetReportBrandPeople(int id)
        {
            DataTable dt = SPs.GetReportBrandPeople(id).GetDataSet().Tables[0];
            return dt;
        }
      
    }

}